﻿using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Web;
using System.Data;

using FileUploader.Core;

namespace FileUploader
{
    /// <summary>
    /// 
    /// </summary>
    public class FileProcessor : IUploadedFileProcessor
    {
        #region IUploadedFileProcessor Members

        public void ProcessFile(HttpContext Context, string FileGuid, string FileName, string ContextParam)
        {
            string sandboxPath = Path.Combine(Sandbox.UploaderControlSandboxPath, FileGuid);

            using (FileStream fs = File.OpenRead(sandboxPath))
            {
                // do something useful to the file
            }
            
            // for testing, this example just deletes the file from the sandbox after it has been uploaded; comment
            // out this line if you want to verify that files are being uploaded correctly while testing
            File.Delete(sandboxPath);
        }

        #endregion
    }
}
